-
Notifications
You must be signed in to change notification settings - Fork 11
feat: implement a trusted file transfer for backend uploads #595
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
elfedy
wants to merge
36
commits into
main
Choose a base branch
from
feat/backend-full-upload
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
B3-backendnoteworthy
Changes should be mentioned in SH backend related release notes
B5-clientnoteworthy
Changes should be mentioned client-related release notes
breaking
Needs to be mentioned in breaking changes
D5-needsaudit👮
PR contains changes to logic that should be properly reviewed and externally audited
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Nodes can now spawn an HTTP server that is meant to receive chunked files as a stream, without actually having to send the proofs for each chunk. The endpoint is meant only for "trusted" sources that would validate the files are correct before sending them (Since validation happens after storing all chunks, whoever can hit the endpoint can DoS the MSP by sending lots of files).
The endpoint is now used by the backend, replacing the rpc/p2p dedicated logic that handled the sending of proven chunks for files.
msp_trusted_file_transfer_server_urlargument to the backend. Backend now needs access to this endpoint for uploads to work properly.trusted_file_transfer_server,trusted_file_transfer_server_hostandtrusted_file_transfer_server_portoptions for the storage hub node to spawn the server (Warning: The server is not meant to be exposed to the public, it should only be reachable to the backend servers via firewall rules)Who is affected
MSP providers who expose a backend endpoint.
Suggested code changes
msp_trusted_file_transfer_server_urlaccordingly.Further Changes
FileIncompleteerror). This is probably better handled at the file_storage level. For now the backend gatekeeps concurrent writes via a guard (see fix(backend): 🐛 avoid concurrent uploads for the same file key #586)Extra Notes
upload_to_mspbackend test that uses mocks because it required restructuring things just for the connection with the http server to be mockable and the flow is already covered by both the backend integration tests and theprocess_chunk_streamtests. Adding a mocked test adds little to no value for the extra complexity imo.shc-commonbecause addingshc-clientas a backend dependency caused many conflicts due to it being compiled withno-std. I was not able to find a trivial way to propagate thestdfeature on the required packages.